<?php namespace Admin\Model;
use Hdphp\Model\Model;
//商品详细 模型
class GoodsDetail extends Model{
//	指定表名
	protected $table = 'goods_detail';
//	自动验证
	protected $validate =array(
	array('img','required','必须上传图片',3,3),
	array('detail','required','请填写商品详情',3,3)
	);
	
//	添加 商品详情
	public function store($detailArr){
		if(!$this->create())  return false;
		$this->add($detailArr);
		return true;
	}
//	编辑商品详细
	public function edit($gid){
		$img_str = implode(',', Q('post.img',array()));
			$detailArr = array(
				'goods_gid' =>$gid,
				'detail' => Q('post.detail'),
				'img' =>$img_str,
				'serve' =>Q('post.serve')
			);
			$this->where("goods_gid={$gid}")->save($detailArr);
			return true;
	}
}





 ?>